/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.triumphsys.icici.cmeeting.portlet.service.persistence;

import com.liferay.portal.NoSuchModelException;
import com.liferay.portal.kernel.annotation.BeanReference;
import com.liferay.portal.kernel.cache.CacheRegistryUtil;
import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
import com.liferay.portal.kernel.dao.orm.FinderPath;
import com.liferay.portal.kernel.dao.orm.Query;
import com.liferay.portal.kernel.dao.orm.QueryPos;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.dao.orm.Session;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.InstanceFactory;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.model.ModelListener;
import com.liferay.portal.service.persistence.BatchSessionUtil;
import com.liferay.portal.service.persistence.ResourcePersistence;
import com.liferay.portal.service.persistence.UserPersistence;
import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;

import com.triumphsys.icici.cmeeting.portlet.NoSuchCMProposalException;
import com.triumphsys.icici.cmeeting.portlet.model.CMProposal;
import com.triumphsys.icici.cmeeting.portlet.model.impl.CMProposalImpl;
import com.triumphsys.icici.cmeeting.portlet.model.impl.CMProposalModelImpl;

import java.io.Serializable;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * The persistence implementation for the c m proposal service.
 *
 * <p>
 * Never modify or reference this class directly. Always use {@link CMProposalUtil} to access the c m proposal persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
 * </p>
 *
 * <p>
 * Caching information and settings can be found in <code>portal.properties</code>
 * </p>
 *
 * @author Triumphsys
 * @see CMProposalPersistence
 * @see CMProposalUtil
 * @generated
 */
public class CMProposalPersistenceImpl extends BasePersistenceImpl<CMProposal>
	implements CMProposalPersistence {
	public static final String FINDER_CLASS_NAME_ENTITY = CMProposalImpl.class.getName();
	public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
		".List";
	public static final FinderPath FINDER_PATH_FIND_BY_PROPOSALTYPEID = new FinderPath(CMProposalModelImpl.ENTITY_CACHE_ENABLED,
			CMProposalModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findByproposalTypeId",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_COUNT_BY_PROPOSALTYPEID = new FinderPath(CMProposalModelImpl.ENTITY_CACHE_ENABLED,
			CMProposalModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countByproposalTypeId", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_FIND_BY_ENTITYID = new FinderPath(CMProposalModelImpl.ENTITY_CACHE_ENABLED,
			CMProposalModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findByentityId",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_COUNT_BY_ENTITYID = new FinderPath(CMProposalModelImpl.ENTITY_CACHE_ENABLED,
			CMProposalModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countByentityId", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(CMProposalModelImpl.ENTITY_CACHE_ENABLED,
			CMProposalModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"findAll", new String[0]);
	public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(CMProposalModelImpl.ENTITY_CACHE_ENABLED,
			CMProposalModelImpl.FINDER_CACHE_ENABLED, FINDER_CLASS_NAME_LIST,
			"countAll", new String[0]);

	/**
	 * Caches the c m proposal in the entity cache if it is enabled.
	 *
	 * @param cmProposal the c m proposal to cache
	 */
	public void cacheResult(CMProposal cmProposal) {
		EntityCacheUtil.putResult(CMProposalModelImpl.ENTITY_CACHE_ENABLED,
			CMProposalImpl.class, cmProposal.getPrimaryKey(), cmProposal);
	}

	/**
	 * Caches the c m proposals in the entity cache if it is enabled.
	 *
	 * @param cmProposals the c m proposals to cache
	 */
	public void cacheResult(List<CMProposal> cmProposals) {
		for (CMProposal cmProposal : cmProposals) {
			if (EntityCacheUtil.getResult(
						CMProposalModelImpl.ENTITY_CACHE_ENABLED,
						CMProposalImpl.class, cmProposal.getPrimaryKey(), this) == null) {
				cacheResult(cmProposal);
			}
		}
	}

	/**
	 * Clears the cache for all c m proposals.
	 *
	 * <p>
	 * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
	 * </p>
	 */
	public void clearCache() {
		CacheRegistryUtil.clear(CMProposalImpl.class.getName());
		EntityCacheUtil.clearCache(CMProposalImpl.class.getName());
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
	}

	/**
	 * Clears the cache for the c m proposal.
	 *
	 * <p>
	 * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
	 * </p>
	 */
	public void clearCache(CMProposal cmProposal) {
		EntityCacheUtil.removeResult(CMProposalModelImpl.ENTITY_CACHE_ENABLED,
			CMProposalImpl.class, cmProposal.getPrimaryKey());
	}

	/**
	 * Creates a new c m proposal with the primary key. Does not add the c m proposal to the database.
	 *
	 * @param proposalId the primary key for the new c m proposal
	 * @return the new c m proposal
	 */
	public CMProposal create(long proposalId) {
		CMProposal cmProposal = new CMProposalImpl();

		cmProposal.setNew(true);
		cmProposal.setPrimaryKey(proposalId);

		return cmProposal;
	}

	/**
	 * Removes the c m proposal with the primary key from the database. Also notifies the appropriate model listeners.
	 *
	 * @param primaryKey the primary key of the c m proposal to remove
	 * @return the c m proposal that was removed
	 * @throws com.liferay.portal.NoSuchModelException if a c m proposal with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public CMProposal remove(Serializable primaryKey)
		throws NoSuchModelException, SystemException {
		return remove(((Long)primaryKey).longValue());
	}

	/**
	 * Removes the c m proposal with the primary key from the database. Also notifies the appropriate model listeners.
	 *
	 * @param proposalId the primary key of the c m proposal to remove
	 * @return the c m proposal that was removed
	 * @throws com.triumphsys.icici.cmeeting.portlet.NoSuchCMProposalException if a c m proposal with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public CMProposal remove(long proposalId)
		throws NoSuchCMProposalException, SystemException {
		Session session = null;

		try {
			session = openSession();

			CMProposal cmProposal = (CMProposal)session.get(CMProposalImpl.class,
					new Long(proposalId));

			if (cmProposal == null) {
				if (_log.isWarnEnabled()) {
					_log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + proposalId);
				}

				throw new NoSuchCMProposalException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
					proposalId);
			}

			return remove(cmProposal);
		}
		catch (NoSuchCMProposalException nsee) {
			throw nsee;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected CMProposal removeImpl(CMProposal cmProposal)
		throws SystemException {
		cmProposal = toUnwrappedModel(cmProposal);

		Session session = null;

		try {
			session = openSession();

			BatchSessionUtil.delete(session, cmProposal);
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}

		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

		EntityCacheUtil.removeResult(CMProposalModelImpl.ENTITY_CACHE_ENABLED,
			CMProposalImpl.class, cmProposal.getPrimaryKey());

		return cmProposal;
	}

	public CMProposal updateImpl(
		com.triumphsys.icici.cmeeting.portlet.model.CMProposal cmProposal,
		boolean merge) throws SystemException {
		cmProposal = toUnwrappedModel(cmProposal);

		Session session = null;

		try {
			session = openSession();

			BatchSessionUtil.update(session, cmProposal, merge);

			cmProposal.setNew(false);
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}

		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);

		EntityCacheUtil.putResult(CMProposalModelImpl.ENTITY_CACHE_ENABLED,
			CMProposalImpl.class, cmProposal.getPrimaryKey(), cmProposal);

		return cmProposal;
	}

	protected CMProposal toUnwrappedModel(CMProposal cmProposal) {
		if (cmProposal instanceof CMProposalImpl) {
			return cmProposal;
		}

		CMProposalImpl cmProposalImpl = new CMProposalImpl();

		cmProposalImpl.setNew(cmProposal.isNew());
		cmProposalImpl.setPrimaryKey(cmProposal.getPrimaryKey());

		cmProposalImpl.setProposalId(cmProposal.getProposalId());
		cmProposalImpl.setGroupId(cmProposal.getGroupId());
		cmProposalImpl.setMeetingId(cmProposal.getMeetingId());
		cmProposalImpl.setUserId(cmProposal.getUserId());
		cmProposalImpl.setCreateDate(cmProposal.getCreateDate());
		cmProposalImpl.setModifiedDate(cmProposal.getModifiedDate());
		cmProposalImpl.setOpsRegionId(cmProposal.getOpsRegionId());
		cmProposalImpl.setProposalDesc(cmProposal.getProposalDesc());
		cmProposalImpl.setProposalFileId(cmProposal.getProposalFileId());
		cmProposalImpl.setExtractFileId(cmProposal.getExtractFileId());
		cmProposalImpl.setMomFilId(cmProposal.getMomFilId());
		cmProposalImpl.setActive(cmProposal.getActive());
		cmProposalImpl.setStatus(cmProposal.getStatus());
		cmProposalImpl.setProposalTypeId(cmProposal.getProposalTypeId());
		cmProposalImpl.setEntityId(cmProposal.getEntityId());
		cmProposalImpl.setMeetingStatus(cmProposal.getMeetingStatus());
		cmProposalImpl.setSubForumId(cmProposal.getSubForumId());
		cmProposalImpl.setCompantCode(cmProposal.getCompantCode());

		return cmProposalImpl;
	}

	/**
	 * Finds the c m proposal with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
	 *
	 * @param primaryKey the primary key of the c m proposal to find
	 * @return the c m proposal
	 * @throws com.liferay.portal.NoSuchModelException if a c m proposal with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public CMProposal findByPrimaryKey(Serializable primaryKey)
		throws NoSuchModelException, SystemException {
		return findByPrimaryKey(((Long)primaryKey).longValue());
	}

	/**
	 * Finds the c m proposal with the primary key or throws a {@link com.triumphsys.icici.cmeeting.portlet.NoSuchCMProposalException} if it could not be found.
	 *
	 * @param proposalId the primary key of the c m proposal to find
	 * @return the c m proposal
	 * @throws com.triumphsys.icici.cmeeting.portlet.NoSuchCMProposalException if a c m proposal with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public CMProposal findByPrimaryKey(long proposalId)
		throws NoSuchCMProposalException, SystemException {
		CMProposal cmProposal = fetchByPrimaryKey(proposalId);

		if (cmProposal == null) {
			if (_log.isWarnEnabled()) {
				_log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + proposalId);
			}

			throw new NoSuchCMProposalException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
				proposalId);
		}

		return cmProposal;
	}

	/**
	 * Finds the c m proposal with the primary key or returns <code>null</code> if it could not be found.
	 *
	 * @param primaryKey the primary key of the c m proposal to find
	 * @return the c m proposal, or <code>null</code> if a c m proposal with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public CMProposal fetchByPrimaryKey(Serializable primaryKey)
		throws SystemException {
		return fetchByPrimaryKey(((Long)primaryKey).longValue());
	}

	/**
	 * Finds the c m proposal with the primary key or returns <code>null</code> if it could not be found.
	 *
	 * @param proposalId the primary key of the c m proposal to find
	 * @return the c m proposal, or <code>null</code> if a c m proposal with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public CMProposal fetchByPrimaryKey(long proposalId)
		throws SystemException {
		CMProposal cmProposal = (CMProposal)EntityCacheUtil.getResult(CMProposalModelImpl.ENTITY_CACHE_ENABLED,
				CMProposalImpl.class, proposalId, this);

		if (cmProposal == null) {
			Session session = null;

			try {
				session = openSession();

				cmProposal = (CMProposal)session.get(CMProposalImpl.class,
						new Long(proposalId));
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (cmProposal != null) {
					cacheResult(cmProposal);
				}

				closeSession(session);
			}
		}

		return cmProposal;
	}

	/**
	 * Finds all the c m proposals where proposalTypeId = &#63;.
	 *
	 * @param proposalTypeId the proposal type id to search with
	 * @return the matching c m proposals
	 * @throws SystemException if a system exception occurred
	 */
	public List<CMProposal> findByproposalTypeId(long proposalTypeId)
		throws SystemException {
		return findByproposalTypeId(proposalTypeId, QueryUtil.ALL_POS,
			QueryUtil.ALL_POS, null);
	}

	/**
	 * Finds a range of all the c m proposals where proposalTypeId = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param proposalTypeId the proposal type id to search with
	 * @param start the lower bound of the range of c m proposals to return
	 * @param end the upper bound of the range of c m proposals to return (not inclusive)
	 * @return the range of matching c m proposals
	 * @throws SystemException if a system exception occurred
	 */
	public List<CMProposal> findByproposalTypeId(long proposalTypeId,
		int start, int end) throws SystemException {
		return findByproposalTypeId(proposalTypeId, start, end, null);
	}

	/**
	 * Finds an ordered range of all the c m proposals where proposalTypeId = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param proposalTypeId the proposal type id to search with
	 * @param start the lower bound of the range of c m proposals to return
	 * @param end the upper bound of the range of c m proposals to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of matching c m proposals
	 * @throws SystemException if a system exception occurred
	 */
	public List<CMProposal> findByproposalTypeId(long proposalTypeId,
		int start, int end, OrderByComparator orderByComparator)
		throws SystemException {
		Object[] finderArgs = new Object[] {
				proposalTypeId,
				
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<CMProposal> list = (List<CMProposal>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_PROPOSALTYPEID,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(3);
			}

			query.append(_SQL_SELECT_CMPROPOSAL_WHERE);

			query.append(_FINDER_COLUMN_PROPOSALTYPEID_PROPOSALTYPEID_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			else {
				query.append(CMProposalModelImpl.ORDER_BY_JPQL);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(proposalTypeId);

				list = (List<CMProposal>)QueryUtil.list(q, getDialect(), start,
						end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_PROPOSALTYPEID,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_PROPOSALTYPEID,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Finds the first c m proposal in the ordered set where proposalTypeId = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param proposalTypeId the proposal type id to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the first matching c m proposal
	 * @throws com.triumphsys.icici.cmeeting.portlet.NoSuchCMProposalException if a matching c m proposal could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public CMProposal findByproposalTypeId_First(long proposalTypeId,
		OrderByComparator orderByComparator)
		throws NoSuchCMProposalException, SystemException {
		List<CMProposal> list = findByproposalTypeId(proposalTypeId, 0, 1,
				orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("proposalTypeId=");
			msg.append(proposalTypeId);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchCMProposalException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the last c m proposal in the ordered set where proposalTypeId = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param proposalTypeId the proposal type id to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the last matching c m proposal
	 * @throws com.triumphsys.icici.cmeeting.portlet.NoSuchCMProposalException if a matching c m proposal could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public CMProposal findByproposalTypeId_Last(long proposalTypeId,
		OrderByComparator orderByComparator)
		throws NoSuchCMProposalException, SystemException {
		int count = countByproposalTypeId(proposalTypeId);

		List<CMProposal> list = findByproposalTypeId(proposalTypeId, count - 1,
				count, orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("proposalTypeId=");
			msg.append(proposalTypeId);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchCMProposalException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the c m proposals before and after the current c m proposal in the ordered set where proposalTypeId = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param proposalId the primary key of the current c m proposal
	 * @param proposalTypeId the proposal type id to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the previous, current, and next c m proposal
	 * @throws com.triumphsys.icici.cmeeting.portlet.NoSuchCMProposalException if a c m proposal with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public CMProposal[] findByproposalTypeId_PrevAndNext(long proposalId,
		long proposalTypeId, OrderByComparator orderByComparator)
		throws NoSuchCMProposalException, SystemException {
		CMProposal cmProposal = findByPrimaryKey(proposalId);

		Session session = null;

		try {
			session = openSession();

			CMProposal[] array = new CMProposalImpl[3];

			array[0] = getByproposalTypeId_PrevAndNext(session, cmProposal,
					proposalTypeId, orderByComparator, true);

			array[1] = cmProposal;

			array[2] = getByproposalTypeId_PrevAndNext(session, cmProposal,
					proposalTypeId, orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected CMProposal getByproposalTypeId_PrevAndNext(Session session,
		CMProposal cmProposal, long proposalTypeId,
		OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_CMPROPOSAL_WHERE);

		query.append(_FINDER_COLUMN_PROPOSALTYPEID_PROPOSALTYPEID_2);

		if (orderByComparator != null) {
			String[] orderByFields = orderByComparator.getOrderByFields();

			if (orderByFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		else {
			query.append(CMProposalModelImpl.ORDER_BY_JPQL);
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(proposalTypeId);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByValues(cmProposal);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<CMProposal> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Finds all the c m proposals where entityId = &#63;.
	 *
	 * @param entityId the entity id to search with
	 * @return the matching c m proposals
	 * @throws SystemException if a system exception occurred
	 */
	public List<CMProposal> findByentityId(long entityId)
		throws SystemException {
		return findByentityId(entityId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
			null);
	}

	/**
	 * Finds a range of all the c m proposals where entityId = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param entityId the entity id to search with
	 * @param start the lower bound of the range of c m proposals to return
	 * @param end the upper bound of the range of c m proposals to return (not inclusive)
	 * @return the range of matching c m proposals
	 * @throws SystemException if a system exception occurred
	 */
	public List<CMProposal> findByentityId(long entityId, int start, int end)
		throws SystemException {
		return findByentityId(entityId, start, end, null);
	}

	/**
	 * Finds an ordered range of all the c m proposals where entityId = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param entityId the entity id to search with
	 * @param start the lower bound of the range of c m proposals to return
	 * @param end the upper bound of the range of c m proposals to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of matching c m proposals
	 * @throws SystemException if a system exception occurred
	 */
	public List<CMProposal> findByentityId(long entityId, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] {
				entityId,
				
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<CMProposal> list = (List<CMProposal>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_ENTITYID,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(3);
			}

			query.append(_SQL_SELECT_CMPROPOSAL_WHERE);

			query.append(_FINDER_COLUMN_ENTITYID_ENTITYID_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			else {
				query.append(CMProposalModelImpl.ORDER_BY_JPQL);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(entityId);

				list = (List<CMProposal>)QueryUtil.list(q, getDialect(), start,
						end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_ENTITYID,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_ENTITYID,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Finds the first c m proposal in the ordered set where entityId = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param entityId the entity id to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the first matching c m proposal
	 * @throws com.triumphsys.icici.cmeeting.portlet.NoSuchCMProposalException if a matching c m proposal could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public CMProposal findByentityId_First(long entityId,
		OrderByComparator orderByComparator)
		throws NoSuchCMProposalException, SystemException {
		List<CMProposal> list = findByentityId(entityId, 0, 1, orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("entityId=");
			msg.append(entityId);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchCMProposalException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the last c m proposal in the ordered set where entityId = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param entityId the entity id to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the last matching c m proposal
	 * @throws com.triumphsys.icici.cmeeting.portlet.NoSuchCMProposalException if a matching c m proposal could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public CMProposal findByentityId_Last(long entityId,
		OrderByComparator orderByComparator)
		throws NoSuchCMProposalException, SystemException {
		int count = countByentityId(entityId);

		List<CMProposal> list = findByentityId(entityId, count - 1, count,
				orderByComparator);

		if (list.isEmpty()) {
			StringBundler msg = new StringBundler(4);

			msg.append(_NO_SUCH_ENTITY_WITH_KEY);

			msg.append("entityId=");
			msg.append(entityId);

			msg.append(StringPool.CLOSE_CURLY_BRACE);

			throw new NoSuchCMProposalException(msg.toString());
		}
		else {
			return list.get(0);
		}
	}

	/**
	 * Finds the c m proposals before and after the current c m proposal in the ordered set where entityId = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param proposalId the primary key of the current c m proposal
	 * @param entityId the entity id to search with
	 * @param orderByComparator the comparator to order the set by
	 * @return the previous, current, and next c m proposal
	 * @throws com.triumphsys.icici.cmeeting.portlet.NoSuchCMProposalException if a c m proposal with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public CMProposal[] findByentityId_PrevAndNext(long proposalId,
		long entityId, OrderByComparator orderByComparator)
		throws NoSuchCMProposalException, SystemException {
		CMProposal cmProposal = findByPrimaryKey(proposalId);

		Session session = null;

		try {
			session = openSession();

			CMProposal[] array = new CMProposalImpl[3];

			array[0] = getByentityId_PrevAndNext(session, cmProposal, entityId,
					orderByComparator, true);

			array[1] = cmProposal;

			array[2] = getByentityId_PrevAndNext(session, cmProposal, entityId,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected CMProposal getByentityId_PrevAndNext(Session session,
		CMProposal cmProposal, long entityId,
		OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_CMPROPOSAL_WHERE);

		query.append(_FINDER_COLUMN_ENTITYID_ENTITYID_2);

		if (orderByComparator != null) {
			String[] orderByFields = orderByComparator.getOrderByFields();

			if (orderByFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		else {
			query.append(CMProposalModelImpl.ORDER_BY_JPQL);
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(entityId);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByValues(cmProposal);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<CMProposal> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Finds all the c m proposals.
	 *
	 * @return the c m proposals
	 * @throws SystemException if a system exception occurred
	 */
	public List<CMProposal> findAll() throws SystemException {
		return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Finds a range of all the c m proposals.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param start the lower bound of the range of c m proposals to return
	 * @param end the upper bound of the range of c m proposals to return (not inclusive)
	 * @return the range of c m proposals
	 * @throws SystemException if a system exception occurred
	 */
	public List<CMProposal> findAll(int start, int end)
		throws SystemException {
		return findAll(start, end, null);
	}

	/**
	 * Finds an ordered range of all the c m proposals.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param start the lower bound of the range of c m proposals to return
	 * @param end the upper bound of the range of c m proposals to return (not inclusive)
	 * @param orderByComparator the comparator to order the results by
	 * @return the ordered range of c m proposals
	 * @throws SystemException if a system exception occurred
	 */
	public List<CMProposal> findAll(int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] {
				String.valueOf(start), String.valueOf(end),
				String.valueOf(orderByComparator)
			};

		List<CMProposal> list = (List<CMProposal>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;
			String sql = null;

			if (orderByComparator != null) {
				query = new StringBundler(2 +
						(orderByComparator.getOrderByFields().length * 3));

				query.append(_SQL_SELECT_CMPROPOSAL);

				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);

				sql = query.toString();
			}
			else {
				sql = _SQL_SELECT_CMPROPOSAL.concat(CMProposalModelImpl.ORDER_BY_JPQL);
			}

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				if (orderByComparator == null) {
					list = (List<CMProposal>)QueryUtil.list(q, getDialect(),
							start, end, false);

					Collections.sort(list);
				}
				else {
					list = (List<CMProposal>)QueryUtil.list(q, getDialect(),
							start, end);
				}
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
						finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
						list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Removes all the c m proposals where proposalTypeId = &#63; from the database.
	 *
	 * @param proposalTypeId the proposal type id to search with
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByproposalTypeId(long proposalTypeId)
		throws SystemException {
		for (CMProposal cmProposal : findByproposalTypeId(proposalTypeId)) {
			remove(cmProposal);
		}
	}

	/**
	 * Removes all the c m proposals where entityId = &#63; from the database.
	 *
	 * @param entityId the entity id to search with
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByentityId(long entityId) throws SystemException {
		for (CMProposal cmProposal : findByentityId(entityId)) {
			remove(cmProposal);
		}
	}

	/**
	 * Removes all the c m proposals from the database.
	 *
	 * @throws SystemException if a system exception occurred
	 */
	public void removeAll() throws SystemException {
		for (CMProposal cmProposal : findAll()) {
			remove(cmProposal);
		}
	}

	/**
	 * Counts all the c m proposals where proposalTypeId = &#63;.
	 *
	 * @param proposalTypeId the proposal type id to search with
	 * @return the number of matching c m proposals
	 * @throws SystemException if a system exception occurred
	 */
	public int countByproposalTypeId(long proposalTypeId)
		throws SystemException {
		Object[] finderArgs = new Object[] { proposalTypeId };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_PROPOSALTYPEID,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_CMPROPOSAL_WHERE);

			query.append(_FINDER_COLUMN_PROPOSALTYPEID_PROPOSALTYPEID_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(proposalTypeId);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_PROPOSALTYPEID,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Counts all the c m proposals where entityId = &#63;.
	 *
	 * @param entityId the entity id to search with
	 * @return the number of matching c m proposals
	 * @throws SystemException if a system exception occurred
	 */
	public int countByentityId(long entityId) throws SystemException {
		Object[] finderArgs = new Object[] { entityId };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_ENTITYID,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_CMPROPOSAL_WHERE);

			query.append(_FINDER_COLUMN_ENTITYID_ENTITYID_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(entityId);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_ENTITYID,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Counts all the c m proposals.
	 *
	 * @return the number of c m proposals
	 * @throws SystemException if a system exception occurred
	 */
	public int countAll() throws SystemException {
		Object[] finderArgs = new Object[0];

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
				finderArgs, this);

		if (count == null) {
			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(_SQL_COUNT_CMPROPOSAL);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
					count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Initializes the c m proposal persistence.
	 */
	public void afterPropertiesSet() {
		String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
					com.liferay.util.service.ServiceProps.get(
						"value.object.listener.com.triumphsys.icici.cmeeting.portlet.model.CMProposal")));

		if (listenerClassNames.length > 0) {
			try {
				List<ModelListener<CMProposal>> listenersList = new ArrayList<ModelListener<CMProposal>>();

				for (String listenerClassName : listenerClassNames) {
					listenersList.add((ModelListener<CMProposal>)InstanceFactory.newInstance(
							listenerClassName));
				}

				listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
			}
			catch (Exception e) {
				_log.error(e);
			}
		}
	}

	public void destroy() {
		EntityCacheUtil.removeCache(CMProposalImpl.class.getName());
		FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
		FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
	}

	@BeanReference(type = CMHolidayPersistence.class)
	protected CMHolidayPersistence cmHolidayPersistence;
	@BeanReference(type = CMParameterPersistence.class)
	protected CMParameterPersistence cmParameterPersistence;
	@BeanReference(type = CMUserPersistence.class)
	protected CMUserPersistence cmUserPersistence;
	@BeanReference(type = CMCreditRatingPersistence.class)
	protected CMCreditRatingPersistence cmCreditRatingPersistence;
	@BeanReference(type = COEPropoalTypePersistence.class)
	protected COEPropoalTypePersistence coePropoalTypePersistence;
	@BeanReference(type = CMIndustryPersistence.class)
	protected CMIndustryPersistence cmIndustryPersistence;
	@BeanReference(type = CMCompanyPersistence.class)
	protected CMCompanyPersistence cmCompanyPersistence;
	@BeanReference(type = CMControlGroupPersistence.class)
	protected CMControlGroupPersistence cmControlGroupPersistence;
	@BeanReference(type = CMRolePersistence.class)
	protected CMRolePersistence cmRolePersistence;
	@BeanReference(type = CMBranchPersistence.class)
	protected CMBranchPersistence cmBranchPersistence;
	@BeanReference(type = CMRegionPersistence.class)
	protected CMRegionPersistence cmRegionPersistence;
	@BeanReference(type = CMForumPersistence.class)
	protected CMForumPersistence cmForumPersistence;
	@BeanReference(type = CMSubForumPersistence.class)
	protected CMSubForumPersistence cmSubForumPersistence;
	@BeanReference(type = CMSanctionProposalPersistence.class)
	protected CMSanctionProposalPersistence cmSanctionProposalPersistence;
	@BeanReference(type = CMReportingProposalPersistence.class)
	protected CMReportingProposalPersistence cmReportingProposalPersistence;
	@BeanReference(type = CMPostProposalPersistence.class)
	protected CMPostProposalPersistence cmPostProposalPersistence;
	@BeanReference(type = CMMeetingPersistence.class)
	protected CMMeetingPersistence cmMeetingPersistence;
	@BeanReference(type = CMProposalTypePersistence.class)
	protected CMProposalTypePersistence cmProposalTypePersistence;
	@BeanReference(type = CMEntityPersistence.class)
	protected CMEntityPersistence cmEntityPersistence;
	@BeanReference(type = CMOthersProposalPersistence.class)
	protected CMOthersProposalPersistence cmOthersProposalPersistence;
	@BeanReference(type = CMValuationProposalPersistence.class)
	protected CMValuationProposalPersistence cmValuationProposalPersistence;
	@BeanReference(type = CMPoliciesProposalPersistence.class)
	protected CMPoliciesProposalPersistence cmPoliciesProposalPersistence;
	@BeanReference(type = CMProposalPersistence.class)
	protected CMProposalPersistence cmProposalPersistence;
	@BeanReference(type = ResourcePersistence.class)
	protected ResourcePersistence resourcePersistence;
	@BeanReference(type = UserPersistence.class)
	protected UserPersistence userPersistence;
	private static final String _SQL_SELECT_CMPROPOSAL = "SELECT cmProposal FROM CMProposal cmProposal";
	private static final String _SQL_SELECT_CMPROPOSAL_WHERE = "SELECT cmProposal FROM CMProposal cmProposal WHERE ";
	private static final String _SQL_COUNT_CMPROPOSAL = "SELECT COUNT(cmProposal) FROM CMProposal cmProposal";
	private static final String _SQL_COUNT_CMPROPOSAL_WHERE = "SELECT COUNT(cmProposal) FROM CMProposal cmProposal WHERE ";
	private static final String _FINDER_COLUMN_PROPOSALTYPEID_PROPOSALTYPEID_2 = "cmProposal.proposalTypeId = ?";
	private static final String _FINDER_COLUMN_ENTITYID_ENTITYID_2 = "cmProposal.entityId = ?";
	private static final String _ORDER_BY_ENTITY_ALIAS = "cmProposal.";
	private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No CMProposal exists with the primary key ";
	private static final String _NO_SUCH_ENTITY_WITH_KEY = "No CMProposal exists with the key {";
	private static Log _log = LogFactoryUtil.getLog(CMProposalPersistenceImpl.class);
}